﻿<Window x:Class="MECopter.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       
        xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
         Height="1024" Width="1280" Background="#FF2D2D30" WindowStartupLocation="CenterOwner" Foreground="#FFC7C7C7" SizeChanged="Window_SizeChanged" ResizeMode="CanResizeWithGrip">
    <Grid x:Name="mainGrid" Margin="0,0,0,0">

        <!--Menu-->
        <Menu x:Name="topMenu" HorizontalAlignment="Left" Height="23" VerticalAlignment="Top" Width="1280" Foreground="White" Margin="0,0,-6,0">
            <Menu.Background>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFF6F6F6" Offset="1"/>
                    <GradientStop Color="#FFEAE8E8" Offset="1"/>
                    <GradientStop Color="#FFDCD9D9" Offset="0.904"/>
                    <GradientStop Color="#FF007ACC" Offset="0.901"/>
                </LinearGradientBrush>
            </Menu.Background>

            <MenuItem Header="_Quadrocopter">
                <MenuItem x:Name="topMenuQuadroConnect" Header="_Connect" Click="btn_connect_Click" Foreground="Black"/>
                <MenuItem x:Name="topMenuQuadroDisconnect" Header="_Disconnect" Click="btn_disconnect_Click" IsEnabled="False" Foreground="Black"/>
                <Separator />
                <MenuItem x:Name="topMenuQuadroEnableESCs" Header="_Enable ESCs" Click="btn_enableESCs_Click" IsEnabled="False" Foreground="Black"/>
                <MenuItem x:Name="topMenuQuadroDisableESCs" Header="_Disable ESCs" Click="btn_disableESCs_Click" IsEnabled="False" Foreground="Black"/>
            </MenuItem>
            
            <MenuItem Header="_Options">
                <MenuItem Header="_PC" Click="Menu_PC" Foreground="Black"/>
                <MenuItem Header="_Quadrocopter" Click ="Menu_Quadrocopter" Foreground="Black"/>
              
                
            </MenuItem>
            <MenuItem Header="_Help" />
        </Menu>

      

        <!--Accu-->
        <!--
        <GroupBox Header="Accu" HorizontalAlignment="Left" Margin="800,602,0,0" VerticalAlignment="Top" Width="251" Height="140">
        <Grid ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9">Cell 1:</Label>
            <Label Grid.Column="0" Grid.Row="1" Foreground="#FFB9B9B9">Cell 2:</Label>
            <Label Grid.Column="0" Grid.Row="2" Foreground="#FFB9B9B9">Sum:</Label>
            <ProgressBar Grid.Column="1" Grid.Row="0" x:Name="pbCell1" />
            <ProgressBar Grid.Column="1" Grid.Row="1" x:Name="pbCell2"/>
            <ProgressBar Grid.Column="1" Grid.Row="2" x:Name="pbAccu"/>
            </Grid>
        </GroupBox>
        -->
       









        <!--Controll-->


        <StatusBar Margin="0,959,-127,0">
            <TextBlock x:Name="tblSerialStatus">Serial: COM{0} Baudrate {1}</TextBlock>
            <!--<Separator/>
            <TextBlock/>-->

        </StatusBar>
        <GroupBox Header="Input" HorizontalAlignment="Left" Margin="10,28,0,0" VerticalAlignment="Top" Height="318" Width="1215" BorderBrush="#FF007ACC" Foreground="#FF007ACC" BorderThickness="1,1,0,0">
            <Grid Height="298" VerticalAlignment="Top" Margin="10,0,-12,-2">
                <!--Input Values-->
                <GroupBox x:Name="gbCtrl" Header="Input Values" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="281" Width="700" >
                    <Grid ShowGridLines="False" Margin="0,0,0,9" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40" />
                            <ColumnDefinition Width="200" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9" Content="Speed:"/>
                        <Label Grid.Column="0" Grid.Row="1" Foreground="#FFB9B9B9" Content="Yaw:"/>
                        <Label Grid.Column="0" Grid.Row="2" Foreground="#FFB9B9B9" Content="Pitch:"/>
                        <Label Grid.Column="0" Grid.Row="3" Foreground="#FFB9B9B9" Content="Roll:"/>

                        <ProgressBar x:Name="pbCtrlSpeed" Grid.Column="1" Grid.Row="0" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" Foreground="#FF007ACC"/>
                        <Label Grid.Column="1" Grid.Row="0" x:Name="lbCtrlSpeed" Margin="10,0" Content="/Speed/" />

                        <ProgressBar x:Name="pbCtrlYaw" Grid.Column="1" Grid.Row="1" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" Foreground="#FF007ACC"/>
                        <Label Grid.Column="1" Grid.Row="1" x:Name="lbCtrlYaw" Margin="10,0" Content="/Yaw/" />

                        <ProgressBar x:Name="pbCtrlPitch" Grid.Column="1" Grid.Row="2" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" Foreground="#FF007ACC"/>
                        <Label Grid.Column="1" Grid.Row="2" x:Name="lbCtrlPitch" Margin="10,0" Content="/Pitch/" />

                        <ProgressBar x:Name="pbCtrlRoll" Grid.Column="1" Grid.Row="3" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" Foreground="#FF007ACC" />
                        <Label Grid.Column="1" Grid.Row="3" x:Name="lbCtrlRoll" Margin="10,0" Content="/Roll/" />

                        <d3:ChartPlotter x:Name="plotter_input" Grid.Column="2" Margin="10,0,10,10" Grid.RowSpan="5"  >
                            <!--<d3:HorizontalLine Value="1.57" Stroke="Red" StrokeThickness="2"/>
                    <d3:HorizontalLine Value="-1.57" Stroke="Red" StrokeThickness="2"/>-->
                            <d3:ChartPlotter.HorizontalAxis>
                                <d3:HorizontalDateTimeAxis x:Name="input_dateAxis"/>
                            </d3:ChartPlotter.HorizontalAxis>
                            <d3:Header FontFamily="Segoe UI" FontSize="15" Content="Input Values" />
                            <d3:VerticalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Input" />
                            <d3:HorizontalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Time"/>
                        </d3:ChartPlotter>
                    </Grid>
                </GroupBox>

                <!--Input Values-->
                <GroupBox x:Name="gbControll" Header="Controll" HorizontalAlignment="Left" VerticalAlignment="Top" Height="102" Width="220" Margin="705,10,0,0">
                    <Grid ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>
                        <Button x:Name="btn_connect" Content="Connect" Click="btn_connect_Click" Grid.Column="0" Grid.Row="0" Margin="10,8,0,10" HorizontalAlignment="Left" Width="81" />
                        <Button x:Name="btn_disconnect" Content="Disconnect" IsEnabled="False" Click="btn_disconnect_Click" Grid.Column="1" Grid.Row="0" Margin="10,8,0,10" HorizontalAlignment="Left" Width="78"/>

                        <Button x:Name="btn_enableESCs" Content="Enable ESCs" IsEnabled="False" Click="btn_enableESCs_Click" Grid.Column="0" Grid.Row="1" Margin="10,9,0,10" HorizontalAlignment="Left" Width="81"/>
                        <Button x:Name="btn_disableESCs" Content="Disable ESCs" IsEnabled="False" Click="btn_disableESCs_Click" Grid.Column="1" Grid.Row="1" Margin="10,10,0,9" HorizontalAlignment="Left" Width="78"/>



                    </Grid>

                </GroupBox>


            </Grid>
            
            
            
            
        </GroupBox>


      
        <!--Feedback-->
        <GroupBox Header="Feedback" HorizontalAlignment="Left" Margin="10,351,0,0" VerticalAlignment="Top" Height="554" Width="1215" BorderBrush="#FF007ACC" Foreground="#FF007ACC" BorderThickness="1,1,0,0">
            <Grid ShowGridLines="False" Margin="10,10,-10,-10">

                <!--Angle-->
                <GroupBox x:Name="gbAngle" Header="Angle" HorizontalAlignment="Left" VerticalAlignment="Top" Height="250" Width="700">
                    <Grid ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40" />
                            <ColumnDefinition Width="200" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9">Yaw:</Label>
                        <Label Grid.Column="0" Grid.Row="1" Foreground="#FFB9B9B9">Pitch:</Label>
                        <Label Grid.Column="0" Grid.Row="2" Foreground="#FFB9B9B9">Roll:</Label>

                        <ProgressBar x:Name="pbAngleYaw" Grid.Column="1" Grid.Row="0" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" />
                        <Label Grid.Column="1" Grid.Row="0" x:Name="lbYaw" Margin="10,0" >/Yaw/</Label>

                        <ProgressBar x:Name="pbAnglePitch" Grid.Column="1" Grid.Row="1" Height="25" VerticalAlignment="Top" Margin="5,0,10,0"/>
                        <Label Grid.Column="1" Grid.Row="1" x:Name="lbPitch" Margin="10,0,0,0" HorizontalAlignment="Left" Width="157" >/Pitch/</Label>

                        <ProgressBar x:Name="pbAngleRoll" Grid.Column="1" Grid.Row="2" Height="25" VerticalAlignment="Top" Margin="5,0,10,0"/>
                        <Label Grid.Column="1" Grid.Row="2" x:Name="lbRoll" Margin="10,0,0,0" HorizontalAlignment="Left" Width="157" >/Roll/</Label>

                        <d3:ChartPlotter x:Name="plotter_angle" Grid.Column="2"  Margin="10,0,10,10" Grid.RowSpan="4" Grid.ColumnSpan="1" >
                            <d3:ChartPlotter.HorizontalAxis>
                                <d3:HorizontalDateTimeAxis Name="angle_dateAxis"/>
                            </d3:ChartPlotter.HorizontalAxis>
                            <d3:Header FontFamily="Segoe UI" FontSize="15" Content="Angle" />
                            <d3:VerticalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Angle [rad]" />
                            <d3:HorizontalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Time"/>
                            <!--<d3:HorizontalLine Value="1.57" Stroke="Red" StrokeThickness="2"/>
                    <d3:HorizontalLine Value="-1.57" Stroke="Red" StrokeThickness="2"/>-->
                        </d3:ChartPlotter>
                    </Grid>
                </GroupBox>


                <!--PID Values-->
                <GroupBox x:Name="gbPIDVales" Header="PID Values" HorizontalAlignment="Left" Margin="0,255,0,-56" VerticalAlignment="Top" Height="250" Width="700">
                    <Grid ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40" />
                            <ColumnDefinition Width="200" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9">Yaw:</Label>
                        <Label Grid.Column="0" Grid.Row="1" Foreground="#FFB9B9B9">Pitch:</Label>
                        <Label Grid.Column="0" Grid.Row="2" Foreground="#FFB9B9B9">Roll:</Label>

                        <ProgressBar x:Name="pbPIDYaw" Grid.Column="1" Grid.Row="0" Height="25" VerticalAlignment="Top" Margin="5,0,10,0" />
                        <Label Grid.Column="1" Grid.Row="0" x:Name="lbPIDYaw" Margin="10,0" >/Yaw/</Label>

                        <ProgressBar x:Name="pbPIDPitch" Grid.Column="1" Grid.Row="1" Height="25" VerticalAlignment="Top" Margin="5,0,10,0"/>
                        <Label Grid.Column="1" Grid.Row="1" x:Name="lbPIDPitch" Margin="10,0,0,0" HorizontalAlignment="Left" Width="157" >/Pitch/</Label>

                        <ProgressBar x:Name="pbPIDRoll" Grid.Column="1" Grid.Row="2" Height="25" VerticalAlignment="Top" Margin="5,0,10,0"/>
                        <Label Grid.Column="1" Grid.Row="2" x:Name="lbPIDRoll" Margin="10,0,0,0" HorizontalAlignment="Left" Width="157" >/Roll/</Label>

                        <d3:ChartPlotter x:Name="plotter_pid" Grid.Column="2"  Margin="10,0,10,10" Grid.RowSpan="4" Grid.ColumnSpan="1" >
                            <d3:ChartPlotter.HorizontalAxis>
                                <d3:HorizontalDateTimeAxis Name="pid_dateAxis"/>
                            </d3:ChartPlotter.HorizontalAxis>
                            <d3:Header FontFamily="Segoe UI" FontSize="15" Content="PID" />
                            <d3:VerticalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Value" />
                            <d3:HorizontalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Time"/>
                        </d3:ChartPlotter>
                    </Grid>
                </GroupBox>

                <!--Performace-->
                <GroupBox x:Name="gbPerformance" Header="Performance" HorizontalAlignment="Left" Margin="705,0,0,0" VerticalAlignment="Top" Height="250" Width="498">
                    <Grid ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="125" />
                            <ColumnDefinition />

                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9" Content="Arduino Loop Time:" Margin="10,10,0,0" Height="26" VerticalAlignment="Top" HorizontalAlignment="Left" Width="118" Grid.ColumnSpan="2" />
                        <Label Grid.Column="1" Grid.Row="0" Foreground="#FFB9B9B9" Content="/Time/" VerticalAlignment="Top" x:Name="lbArduLoopTime" Height="26" Margin="0,10,20,0" />

                        <d3:ChartPlotter x:Name="plotter_loopTime" Grid.Row="1" Grid.ColumnSpan="2" Margin="10,0,10,10" >
                            <d3:ChartPlotter.HorizontalAxis>
                                <d3:HorizontalDateTimeAxis Name="loopTime_dateAxis" />
                            </d3:ChartPlotter.HorizontalAxis>
                            <d3:Header FontFamily="Segoe UI" FontSize="15" Content="LoopTime" />
                            <d3:VerticalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="LoopTime [μs]" />
                            <d3:HorizontalAxisTitle FontFamily="Segoe UI" FontSize="12" Content="Time"/>
                        </d3:ChartPlotter>
                    </Grid>
                </GroupBox>

                <!--ESC-->
                <GroupBox x:Name="gbCtrl_Copy" Header="ESC Values" HorizontalAlignment="Left" Margin="705,255,0,0" VerticalAlignment="Top" Height="250" Width="250">
                    <GroupBox.Background>
                        <ImageBrush ImageSource="Quadro.png" Opacity="0.995">
                            <ImageBrush.RelativeTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ImageBrush.RelativeTransform>
                        </ImageBrush>
                    </GroupBox.Background>
                    <Grid ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Foreground="#FFB9B9B9" Content="/ESC0/" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="lbESC0" RenderTransformOrigin="0.935,1.115" Margin="33,40,0,10" />
                        <Label Grid.Column="2" Grid.Row="0" Foreground="#FFB9B9B9" Content="/ESC1/" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="lbESC1" RenderTransformOrigin="0.587,0.538" Margin="0,40,33,10" />
                        <Label Grid.Column="0" Grid.Row="2" Foreground="#FFB9B9B9" Content="/ESC2/" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="lbESC2" Margin="33,10,0,40"/>
                        <Label Grid.Column="2" Grid.Row="2" Foreground="#FFB9B9B9" Content="/ESC3/" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="lbESC3" Margin="3,10,30,40" />
                    </Grid>
                </GroupBox>



              
            </Grid>

        </GroupBox>
        <Button Content="Fullscreen" HorizontalAlignment="Left" Margin="10,934,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_3"/>
        <!--<Button Content="Button" HorizontalAlignment="Left" Margin="751,160,0,0" VerticalAlignment="Top" Width="76" Click="Button_Click_1"/>
        <Button Content="Button" HorizontalAlignment="Left" Margin="976,236,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_2"/>-->
    </Grid>
    <Window.Resources>

    </Window.Resources>
</Window>
